<template>
    <div>
        <el-form :inline="true">
            <div style="display: flex; justify-content: space-between;">
                <div />
                <!-- <div>
                    <el-form-item>
                        <el-button type="primary" @click="setUserLevel()">新增</el-button>
                    </el-form-item>
                </div> -->
            </div>
        </el-form>

        <!-- 列表数据 -->
        <el-table v-loading="listLoading" :data="tableData" border style="width: 100%">
            <el-table-column prop="userLevel" label="等级" align="center" />
            <el-table-column prop="userName" label="等级名称" align="center" />
            <el-table-column prop="fwRate" label="管理津贴级差" align="center" />
            <el-table-column label="操作" width="200" align="center">
                <template slot-scope="{ row }">
                    <el-button size="mini" type="primary" @click="setUserLevel(row)">编辑</el-button>
                </template>
            </el-table-column>
        </el-table>

        <!-- 设置等级 -->
        <digsetuserLevel v-if="modalStatus == 1" :info="currentInfo" />

    </div>
</template>

<script>
import { userLevelConfig } from '@/api/sysconfig.js'
import digsetuserLevel from './components/digSetUserLevel.vue'
export default {
    name: 'Name',
    components: { digsetuserLevel },
    data() {
        return {
            activeValue: '',
            typeList: [],

            listLoading: false,
            tableData: [],

            modalStatus: 0, // 打开组件弹窗参数
            currentInfo: {}, // 当前用户信息
        }
    },
    watch: {
        modalStatus(val) {
            this.getdata()
        }
    },
    mounted() {
        this.getdata()
    },
    methods: {
        /**打开设置等级弹窗 */
        setUserLevel(info = {}) {
            this.currentInfo = info;
            this.modalStatus = 1;
        },
        // 获取地区列表
        async getdata() {
            this.listLoading = true
            const { data } = await userLevelConfig()
            this.listLoading = false
            this.tableData = data
        }
    }
}
</script>
<style lang="scss"></style>